Porting SOF vBE#104
Conversation
Signed-off-by: Zhu Yingjiang <yingjiang.zhu@linux.intel.com>
This patch adds the sof virtio misc dev support. It will create a dev node for the communication to the userspace. Signed-off-by: Libin Yang <libin.yang@intel.com>
This patch adds the sof support of open, ioctl and release for misc dev. When open is called, sof creates sof_vbe for each virtual machine to manage the vm. When ioctl cmd shows vFE is ready, sof registers vhm client to manage the vqs. Signed-off-by: Libin Yang <libin.yang@intel.com>
This patch initialize the virtio vq handling. It dispatches the different vq kicks to different handlers. The specific hanlder will be implemented later. Signed-off-by: Libin Yang <libin.yang@intel.com>
This patch constructs the basic flow of handling ipcs from SOF vFE. The specific handling for each type of ipc will be implemented later. Signed-off-by: Libin Yang <libin.yang@intel.com>
This patch handles the tplg ipcs from SOF vFE. vBE will create spcm when receiving the SOF_COMP_HOST ipc. As mentioned in the patch, the next step is to create a whole pcm staff, such as substream. With these, a whole pipeline can be created when playback/capture. Signed-off-by: Libin Yang <libin.yang@intel.com>
This patch handles the stream ipcs from SOF vFE. To save the resource, pcm open is handled in the hw_params cmd and pcm close is handled in the hw_free cmd. In this patch, hda/codec setting is handled with BE link substream. This is safe as the BE substream is dedicated for the speical GOS PCM. However, this is not the normal behavior. The normal behavior is setting hda/codec in the FE link substream, which will be implemented later. Signed-off-by: Libin Yang <libin.yang@intel.com>
This patch implements the position update for SOF vFE. When there is position update from fw, vBE will check whether there is an available entry in notification vq. If yes, send the position update notification immediately. If there is no available entry, add the position update event in a list. As soon as the notification vq has an available entry, send the position update to the vFE. Signed-off-by: Libin Yang <libin.yang@intel.com>
lgirdwood
left a comment
There was a problem hiding this comment.
Almost there. In genrel I need to see more comments. ideally one comment per code block that describes what the code does and why.
| } | ||
|
|
||
| /* autosuspend sof device */ | ||
| pm_runtime_mark_last_busy(sdev->dev); |
There was a problem hiding this comment.
We still need PM for BE and non virtio mode.
There was a problem hiding this comment.
The first patch is Yingjiang's patch. I use this as a code base. Please @zhuyingjiang help answer.
| #include <sound/compress_driver.h> | ||
|
|
||
| #if IS_ENABLED(CONFIG_SND_SOC_SOF_VIRTIO_FE) | ||
| // TODO refine which ones are needed |
There was a problem hiding this comment.
Has refinement of headers been done, if so we can remove.
| struct list_head list; | ||
|
|
||
| // TODO: allow clients to have N streams. Map streams to posn[n] | ||
| struct sof_ipc_stream_posn pos[4]; |
There was a problem hiding this comment.
Best to define a macro here for 4.
| int snd_sof_virtio_miscdev_register(struct snd_sof_dev *sdev); | ||
| int snd_sof_virtio_miscdev_unregister(void); | ||
| #else | ||
| static int snd_sof_virtio_miscdev_register(struct snd_sof_dev *sdev) |
| * VirtIO | ||
| */ | ||
| #define GUEST_COMP_ID_OFFSET 0x100 | ||
| int sof_virtio_submit_guest_ipc(struct snd_sof_dev *sdev, int vm_id, |
There was a problem hiding this comment.
if these are private APIs to only be used within SOF then we can prefix them as sof_virtio_
| vdev->config->del_vqs(vdev); | ||
| kfree(vfe->posn); | ||
|
|
||
| // unregister the devices of SOF |
| return virtio_audio; | ||
| } | ||
|
|
||
| void *get_sof_dev(void) |
| return 0; | ||
| } | ||
|
|
||
| int snd_sof_virtio_miscdev_unregister(void) |
There was a problem hiding this comment.
Do you mean snd_sof_virtio_miscdev_unregister? For module mode, I think yes, we need it when unload the sof modules.
| * | ||
| * Return: 0 for success or negative value for err | ||
| */ | ||
| int snd_audio_virtio_miscdev_register(struct device *dev, void *data, |
There was a problem hiding this comment.
It looks like we are only calling this internally ? if so it should be static.
| static int sbe_pcm_open(struct snd_sof_dev *sdev, | ||
| void *ipc_data, int vm_id) | ||
| { | ||
| /* |
There was a problem hiding this comment.
Stick this comment before func and comment each non obvious block in every function. i.e. I need to know what each block does.
|
Hi Liam, my first patch is copying from Yingjiang. I think he will submit the patch himself. I push it here because I use it as my code base. Otherwise, our patches will conflict. |
The first patch is from Yingjiang and Please ignore it. Thanks.